﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Game_Admin_Demo.admin
{
    public partial class editCat : System.Web.UI.Page
    {
        DataClasses1DataContext dc = new DataClasses1DataContext();
      
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
               int madm = Convert.ToInt32(Request.QueryString["id"]);
              var dm = dc.danhmucs.SingleOrDefault(z => z.madm == madm);
                TextBox1.Text = dm.tendm;
            }
         
            
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                int madm = Convert.ToInt32(Request.QueryString["id"]);
                var dm = dc.danhmucs.SingleOrDefault(z => z.madm == madm);
                dm.tendm = TextBox1.Text;
                dc.SubmitChanges();
                Server.Transfer("Category.aspx");
            }
        }
    }
}